package com.ktc.base.exception;

import entity.Result;
import entity.StatusCode;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author lscl
 * @version 1.0
 * @intro: 全局异常处理器
 */
@ControllerAdvice
public class BaseExceptionHandler {

    @ExceptionHandler(value = Exception.class)
    @ResponseBody
    public Result exception(Exception e) {

        return new Result(false, StatusCode.ERROR,e.getMessage());
    }
}
